package chixing.day07.homwork;

import chixing.day07.inherited.Manger;

public class MyOrder {
    private int orderId;
    private String orderNumber;
    private float orderPrice;
    private int orderStatus;// 订单状态，0：未支付，1：已支付，2： 已取消

    public MyOrder(){}
    public MyOrder(int orderId, String orderNumber, float orderPrice, int orderStatus) {
        this.orderId = orderId;
        this.orderNumber = orderNumber;
        this.orderPrice = orderPrice;
        this.orderStatus = orderStatus;
    }

    //判断订单是否相同
    @Override
    public boolean equals(Object obj) {
        //为空直接返回false//判断参数类型是否相同
        if (obj == null || !this.getClass().equals(obj.getClass()))
            return false;
        //如果是自己本身返回true
        if (this == obj)
            return true;
        //因为形参类型是object类型所以要要进行强制转换
        MyOrder myOrder =(MyOrder) obj;
        //对比属性值是否全部相同
        return  this.orderId == myOrder.orderId && this.orderNumber.equals(myOrder.orderNumber)
                && this.orderPrice == myOrder.orderPrice && this.orderStatus == myOrder.orderStatus;

    }

    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public float getOrderPrice() {
        return orderPrice;
    }

    public void setOrderPrice(float orderPrice) {
        this.orderPrice = orderPrice;
    }

    public int getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(int orderStatus) {
        this.orderStatus = orderStatus;
    }

    @Override
    public String toString() {
        return "MyOrder{" +
                "orderId=" + orderId +
                ", orderNumber='" + orderNumber + '\'' +
                ", orderPrice=" + orderPrice +
                ", orderStatus=" + orderStatus +
                '}';
    }
}
